<extend name="Users:layout" />
<block name="content">
<style>
.ATRoot{padding:0px 5px;height:22px;line-height:22px;clear:both;}
.ATNode{margin-right:5px;;line-height:22px;width:150px;float:left;}
label{cursor:pointer;}
.Hide{display:none;}
dl.areaSelect{display: inline-block; width:100%; margin-bottom: 0;/*border:1px solid #eee;*/}
dl.areaSelect:hover{border:1px solid #E5CD29;}
dl.areaSelect:hover dd{display: block;}
dl.areaSelect dd{margin-left:20px;width:100%;}
.layui-layer-btn a{background:#e23c3d;}


</style>

<script src="__PUBLIC__/plugins/kindeditor/kindeditor.js"></script>
<script src="__PUBLIC__/plugins/kindeditor/lang/zh_CN.js"></script>
   <script>
	var filetypes = ["gif","jpg","png","jpeg"];
   	var relateCommunity = "{$object['relateCommunity']}".split(',');
   	var relateArea = "{$object['relateArea']}".split(',');
   	$(function () {
  	 	//展开按钮
   		$("#expendAll").click(function(){
   			if ($(this).prop('checked')==true) {$("dl.areaSelect dd").removeClass('Hide')}
   			else{$("dl.areaSelect dd").addClass('Hide')}
   		})
	   $.formValidator.initConfig({
		   theme:'Default',mode:'AutoTip',formID:"myshop",debug:true,submitOnce:true,onSuccess:function(){
			   openShop();
			   return false;
			},onError:function(msg){
		}});
	    $("#shopName").formValidator({onShow:"",onFocus:"店铺名称不能超过20个字符",onCorrect:"输入正确"}).inputValidator({min:1,max:40,onError:"店铺名称不符合要求,请确认"});
		$("#userName").formValidator({onShow:"",onFocus:"请输入店主姓名",onCorrect:"输入正确"}).inputValidator({min:1,max:20,onError:"店主姓名不能为空,请确认"});
		$("#shopCompany").formValidator({onShow:"",onFocus:"请输入公司名称",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"公司名称不能为空,请确认"});
		$("#shopTel").formValidator({onShow:"",onFocus:"请输入店铺电话",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"店铺电话不能为空,请确认"});
		$("#shopAddress").formValidator({onShow:"",onFocus:"请输入店铺地址",onCorrect:"输入正确"}).inputValidator({min:1,max:120,onError:"店铺地址不能为空,请确认"});
		$("#areaId3").formValidator({onFocus:"请选择所属地区"}).inputValidator({min:1,onError: "请选择所属地区"});
		$("#goodsCatId2").formValidator({onFocus:"请选择所属行业"}).inputValidator({min:1,onError: "请选择所属行业"});
		$("#bankId").formValidator({onFocus:"请选择所属银行"}).inputValidator({min:1,onError: "请选择所属银行"});
		$("#bankNo").formValidator({onShow:"",onFocus:"请输入银行卡号",onCorrect:"输入正确"}).inputValidator({min:16,max:19,onError:"银行卡号格式错误,请确认"});
    $("#idNo").formValidator({onShow:"",onFocus:"请输入身份证号码",onCorrect:"输入正确"}).inputValidator({min:18,max:18,onError:"身份证号格式错误,请确认"});
    $("#userPhone").formValidator({onShow:"",onFocus:"请输入店主手机号码",onCorrect:"输入正确"}).inputValidator({min:11,max:11,onError:"手机号码格式错误,请确认"});
		
		initTime('serviceStartTime','8');
		initTime('serviceEndTime','20');
		getAreaListForOpen("areaId2",'{$area["parentId"]}',0,'{$area["areaId"]}');
		getAreaListForOpen("areaId3",'{$area["areaId"]}',1);
		getVerify();
		ShopMapInit({});
  });
function getCatListForEdit(objId,parentId,t,id){
     var params = {};
     params.id = parentId;
     $('#'+objId).empty();
     if(t<1){
       $('#goodsCatId3').empty();
       $('#goodsCatId3').html('<option value="">请选择</option>');
       getBrands(parentId);
     }
     var html = [];
     $.post(Think.U('Home/GoodsCats/queryByList'),params,function(data,textStatus){
        html.push('<option value="">请选择</option>');
      var json = WST.toJson(data);
      if(json.status=='1' && json.list){
        var opts = null;
        for(var i=0;i<json.list.length;i++){
          opts = json.list[i];
          html.push('<option value="'+opts.catId+'" '+((id==opts.catId)?'selected':'')+'>'+opts.catName+'</option>');
        }
      }
      $('#'+objId).html(html.join(''));
     });
}
function getBrands(catId){
  var v = $('#brandId').attr('dataVal');
  var params = {};
  params.catId = catId;
  $('#brandId').empty();
  var html = [];
  $('#brandId').append('<option value="0">请选择</option>');
  $.post(Think.U('Home/Brands/queryBrandsByCat'),params,function(data,textStatus){
    var json = WST.toJson(data);
    if(json.status=='1' && json.list){
      for(var i=0;i<json.list.length;i++){
        opts = json.list[i];
        $('#brandId').append('<option value="'+opts.brandId+'" '+((v==opts.brandId)?'selected':'')+'>'+opts.brandName+'</option>');
      }
    }
  })
}
   </script>	
   <div class="wst-body"> 
       <div class='wst-page-header'>买家中心 > 我要开店</div>
       <div class='wst-page-content' style="position:relative;">
       <iframe name="upload" style="display:none"></iframe>
        <!--店铺图标-->
      <form id="uploadform_Filedata" autocomplete="off" style="position:absolute;top:450px;left:138px;z-index:10;"enctype="multipart/form-data" method="POST" target="upload" action="{:U('Home/Shops/uploadPic')}" >
        <div style="position:relative;">
        <input id="shopImg" name="shopImg" disabled="disabled" class="text" type="text" value="{$object.shopImg}" readonly style="margin-right:4px;float:left;margin-left:8px;width:237px;"/>
        <div class="div1">
          <div class="div2">浏览</div>
          <input type="file" class="inputstyle" id="Filedata" name="Filedata" onchange="updfile('Filedata');" >
        </div>
        <div style="clear:both;"></div>
        <div >&nbsp;图片大小:150 x 150 (px)(格式为 gif, jpg, jpeg, png)</div>
        <input type="hidden" name="dir" value="shops">
        <input type="hidden" name="width" value="150">
        <input type="hidden" name="folder" value="Filedata">
        <input type="hidden" name="sfilename" value="Filedata">
        <input type="hidden" name="fname" value="shopImg">
        <input type="hidden" id="s_Filedata" name="s_Filedata" value="">
        </div>
      </form>
      <!--营业执照图片-->
      <form id="uploadform_Perm" autocomplete="off" style="position:absolute;top:665px;left:138px;z-index:10;" enctype="multipart/form-data" method="POST" target="upload" action="{:U('Home/Shops/uploadPic')}" >
            <div style="position:relative;">
                <input id="permitImg" name="permitImg" disabled="disabled" class="text"  type="text" value="{$object.permitImg}" readonly style="margin-right:4px;float:left;margin-left:8px;width:237px;"/>
                <div class="div1">
                    <div class="div2">浏览</div>
                    <input type="file" class="inputstyle" id="Perm" name="Perm" onchange="updfile('Perm');" >
                </div>
                <div style="clear:both;"></div>
                <div >&nbsp;图片大小:150 x 150 (px)(格式为 gif, jpg, jpeg, png)</div>
                <input type="hidden" name="dir" value="shops">
                <input type="hidden" name="width" value="150">
                <input type="hidden" name="folder" value="Perm">
                <input type="hidden" name="sfilename" value="Perm">
                <input type="hidden" name="fname" value="permitImg">
                <input type="hidden" class="s_Filedata" name="s_Filedata" value="">
            </div>
          </form>
          <!--身份证正面图片-->
          <form id="uploadform_Identi" autocomplete="off" style="position:absolute;top:885px;left:138px;z-index:10;" enctype="multipart/form-data" method="POST" target="upload" action="{:U('Home/Shops/uploadPic')}" >
            <div style="position:relative;">
                <input id="identityImg" disabled="disabled" name="identityImg" class="text" type="text" value="{$object.identityImg}" readonly style="margin-right:4px;float:left;margin-left:8px;width:237px;"/>
                <div class="div1">
                    <div class="div2">浏览</div>
                    <input type="file" class="inputstyle" id="Identi" name="Identi" onchange="updfile('Identi');" >
                </div>
                <div style="clear:both;"></div>
                <div >&nbsp;图片大小:150 x 150 (px)(格式为 gif, jpg, jpeg, png)</div>
                <input type="hidden" name="dir" value="shops">
                <input type="hidden" name="width" value="150">
                <input type="hidden" name="folder" value="Identi">
                <input type="hidden" name="sfilename" value="Identi">
                <input type="hidden" name="fname" value="identityImg">
                <input type="hidden" class="s_Filedata" name="s_Filedata" value="">
            </div>
          </form>
          <!--身份证反面图片-->
          <form id="uploadform_Identity" autocomplete="off" style="position:absolute;top:1100px;left:138px;z-index:10;" enctype="multipart/form-data" method="POST" target="upload" action="{:U('Home/Shops/uploadPic')}" >
            <div style="position:relative;">
                <input id="identityRevImg" disabled="disabled" name="identityRevImg" class="text" type="text" value="{$object.identityRevImg}" readonly style="margin-right:4px;float:left;margin-left:8px;width:237px;"/>
                <div class="div1">
                    <div class="div2">浏览</div>
                    <input type="file" class="inputstyle" id="Identity" name="Identity" onchange="updfile('Identity');" >
                </div>
                <div style="clear:both;"></div>
              <div >&nbsp;图片大小:150 x 150 (px)(格式为 gif, jpg, jpeg, png)</div>
                <input type="hidden" name="dir" value="shops">
                <input type="hidden" name="width" value="150">
                <input type="hidden" name="folder" value="Identity">
                <input type="hidden" name="sfilename" value="Identity">
                <input type="hidden" name="fname" value="identityRevImg">
                <input type="hidden" class="s_Filedata" name="s_Filedata" value="">
            </div>
          </form>
       <form name="myshop" method="post" id="myshop" autocomplete="off">
        <input type='hidden' id='id' value='0'/>
        <table class="table table-hover table-striped table-bordered wst-form">
           <tr>
             <th width='130' align='right'>店铺名称<font color='red'>*</font>：</th>
             <td><input type='text' id='shopName' class="form-control wst-ipt" style='width:250px;' maxLength='25'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>店主姓名<font color='red'>*</font>：</th>
             <td><input type='text' id='userName' class="form-control wst-ipt" style='width:250px;' maxLength='25' value='{$WST_USER.userName}'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>公司名称<font color='red'>*</font>：</th>
             <td><input type='text' id='shopCompany' class="form-control wst-ipt"  style='width:250px;' maxLength='25'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>店铺电话<font color='red'>*</font>：</th>
             <td><input type='text' id='shopTel' class="form-control wst-ipt" style='width:200px;' maxLength='25' value="{$object['shopTel']}"/></td>
           </tr>
           <tr>
             <th width='120' align='right'>店铺QQ：</th>
             <td><input type='text' id='qqNo' value="{$object['qqNo']}" class="form-control wst-ipt" style='width:200px;'  maxLength='25'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>电子邮箱：</th>
             <td><input type='text' id='userEmail' value="{$WST_USER.userEmail}" class="form-control wst-ipt" style='width:200px;'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>营业执照编号：</th>
             <td><input type='text' id='permitNo' value="{$object['permitNo']}" class="form-control wst-ipt" style='width:200px;'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>身份证号码<font color='red'>*</font>：</th>
             <td><input type='text' id='idNo' value="{$object['idNo']}" class="form-control wst-ipt" style='width:200px;' maxlength="18" /></td>
           </tr>
           <tr height='150'>
             <th width='120' align='right'>店铺图标：</th>
             <td>
             <div id="preview_Filedata" >
             	<img id='preview' src='__ROOT__/{$CONF['mallLogo']}' height='150' />
             </div>
             </td>
           </tr>
           <tr style='height:auto;position:relative;height:230px;'>
             <th width='120' align='right' style="padding-top:60px;">营业执照图片：</th>
             <td>
             <div id="preview_Perm" style="margin-top: 50px;">
              <img id='permit' src='__ROOT__/{$CONF['mallLogo']}' height='150' style="display:none"/>
             </div>
             </td>
           </tr>
           <tr  style='height:auto;position:relative;height:230px;'>
             <th width='120' align='right' style="padding-top:60px;">身份证正面图片<font color='red'>*</font>：</th>
             <td>
             <div id="preview_Identi" style="margin-top: 20px;">
              <img id='identity' src='__ROOT__/{$CONF['mallLogo']}' height='150' style="display:none"/>
             </div>
             </td>
           </tr>
           <tr  style='height:auto;position:relative;height:230px;'>
             <th width='120' align='right' style="padding-top:60px;">身份证反面图片<font color='red'>*</font>：</th>
             <td>
             <div id="preview_Identity">
              <img id='identityRev' src='__ROOT__/{$CONF['mallLogo']}' height='150' style="display:none"/>
             </div>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'></th>
             <td></td>
           </tr>
           <tr>
             <th width='120' align='right'>所属地区<font color='red'>*</font>：</th>
             <td>
             <select id='areaId1' onchange='javascript:getAreaListForOpen("areaId2",this.value,-1)'>
               <option value=''>请选择</option>
               <volist name="areaList" id="vo">
               <option value='{$vo['areaId']}' <if condition="$area['parentId'] == $vo['areaId'] ">selected</if>>{$vo['areaName']}</option>
               </volist>
             </select>
             <select id='areaId2' onchange='javascript:getAreaListForOpen("areaId3",this.value,0);'>
               <option value=''>请选择</option>
             </select>
             <select id='areaId3'>
               <option value=''>请选择</option>
             </select>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>店铺地址<font color='red'>*</font>：</th>
             <td><input type='text' id='shopAddress' class="form-control wst-ipt" style='width:350px;' maxLength='100'/></td>
           </tr>
           <tr id='shopMap' style='display:none'>
             <td>&nbsp;</td>
             <td>
             <div id="mapContainer" style='height:400px;width:90%;'>等待地图初始化...</div>
             <div style='display:none'>
             <input type='text' id='latitude' name='latitude' value="{$object['latitude']}"/>
             <input type='text' id='longitude' name='longitude' value="{$object['longitude']}"/>
             <input type='text' id='mapLevel' name='mapLevel' value="{$object['mapLevel']}"/>
             </div>
             <div style='color:red'>(注意：提交开店申请之后店铺地址将无法修改)</div>
             </td>
           </tr>
           <tr>
             <th align='right'>所属行业<font color='red'>*</font>：</th>
             <td>
               <select id='goodsCatId1' class='wstipt' onchange='javascript:getCatListForEdit("goodsCatId2",this.value,0)'>
                  <option value=''>请选择</option>
                  <volist name="goodsCatsList" id="vo">
                  <option value='{$vo['catId']}' <if condition="$object['goodsCatId1'] == $vo['catId'] ">selected</if>>{$vo['catName']}</option>
                  </volist>
               </select>
               <select id='goodsCatId2' class='wstipt' >
                  <option value=''>请选择</option>
               </select>
             </td>
           </tr>
           <tr>
             <th align='right'>营业状态<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='shopAtive1' name='shopAtive' value='1' />营业中&nbsp;&nbsp;
             </label>
             <label>
             <input type='radio' id='shopAtive0' name='shopAtive' value='0' checked />休息中
             </label>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>配送区域<font color='red'>*</font>：</th>
             <td>
             <div class="text-gray Hide">展开全部：<input type="checkbox" id="expendAll"></div>
             <div id='areaTree'>
             </div>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>订单配送起步价<font color='red'>*</font>：</th>
             <td><input type="text" id="deliveryStartMoney" class="text" value="0.0" onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxlength="8"></td>
           </tr>
           <tr>
             <th width='120' align='right'>包邮起步价<font color='red'>*</font>：</th>
             <td><input type='text' id='deliveryFreeMoney' class="form-control wst-ipt" value="0.0" onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='8'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>邮费<font color='red'>*</font>：</th>
             <td><input type='text' id='deliveryMoney' class="form-control wst-ipt" value="0.0" onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='8'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>平均消费金额<font color='red'>*</font>：</th>
             <td><input type='text' id='avgeCostMoney' class="form-control wst-ipt" value="0.0" onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='8'/></td>
           </tr>
           <tr>
             <th align='right'>能否开发票<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='isInvoice1' onclick='javascript:isInvoce(true)' name='isInvoice' value='1' />能&nbsp;&nbsp;
             </label>
             <label>
             <input type='radio' id='isInvoice0' onclick='javascript:isInvoce(false)' name='isInvoice' value='0' checked/>否
             </label>
             </td>
           </tr>
           <tr id='invoiceRemarkstr' style='display:none'>
             <th width='120' align='right'>发票说明：</th>
             <td><input type='text' id='invoiceRemarks' class="form-control wst-ipt" value='{$object.invoiceRemarks}' style='width:350px;' maxLength='100'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>转账银行<font color='red'>*</font>：</th>
             <td>
             <select id='bankId'>
                <option value=''>请选择</option>
                <volist name="bankList" id="vo">
                <option value='{$vo['bankId']}'>{$vo['bankName']}</option>
                </volist>
             </select>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>银行卡卡号<font color='red'>*</font>：</th>
             <td><input type='text' id='bankNo' maxLength='25' size='50'/></td>
           </tr>
           <tr>
             <th width='120' align='right'>营业时间<font color='red'>*</font>：</th>
             <td>
             <select id='serviceStartTime'></select>
             至
             <select id='serviceEndTime'></select>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>手机号码<font color='red'>*</font>：</th>
             <td><input type='text' id='userPhone' maxLength='25' value='{$WST_USER.userPhone}'/></td>
           </tr>
           <tr>
             <th>&nbsp;</th>
             <td>
             <label>
	           <input class="checkbox" id="protocol" name="protocol" type="checkbox"/>
	                                 我已阅读并同意</label><a href="javascript:;" class="blue" id="protocolInfo" onclick="showXiey();">《店铺用户注册协议》</a>                       
	         <label id="protocol_error" class="error hide">请接受服务条款</label>
             </td>
           </tr>
           <tr>
             <th align='right'>验证码<font color='red'>*</font>：</th>
             <td>
             <input id="authcode" style="ime-mode:disabled" name="authcode" class="text text-1" tabindex="6" autocomplete="off" maxlength="6" type="text"/>
	         <label class="img">
	            <img style='vertical-align:middle;cursor:pointer;height:25px;' class='verifyImg' title='刷新验证码' onclick='javascript:getVerify()'/> 
			 </label>      	
	         <label class="ftx23">&nbsp;看不清？<a href="javascript:getVerify()" class="flk13">换一张</a></label>
             </td>
           </tr>
           <tr>
             <td colspan='2' style='padding-left:320px;'>
                 <button class='wst-btn-query' type="submit">保&nbsp;存</button>
                 <button class='wst-btn-query' type="button" onclick='javascript:location.reload();'>重&nbsp;置</button>
             </td>
           </tr>
        </table>
       </form>
       </div>
   </div>
   <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=2b53397482f52f92dcb7c528d99d9fca"></script>
</block>  
